package me.zk.practice1.hw;

import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Scanner;

public class HWBJ49 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        String s = scanner.nextLine();

        String[] strings = s.split("@");
        Map<String,Integer> allMap = getAll(strings[0]);
        Map<String,Integer> useMap = getAll(strings[1]);
        for (String key : useMap.keySet()) {
            allMap.put(key,allMap.get(key)-useMap.get(key));
        }
        StringBuilder sb = new StringBuilder();

        for (String key : allMap.keySet()) {
            int value = allMap.get(key);
            if (value == 0) {
                continue;
            }
            sb.append(key).append(":").append(value).append(",");
        }
        System.out.println(sb.subSequence(0,sb.length()-1));

    }

    public static Map<String,Integer> getAll(String s) {
        Map<String,Integer> map = new LinkedHashMap<>();
        if (s.length()!=0){
            String[] s1 = s.split(",");
            for (String value : s1) {
                String[] s2 = value.split(":");
                map.put(s2[0], map.getOrDefault(s2[0], 0) + Integer.parseInt(s2[1]));
            }
        }
        return map;
    }
}
